<script lang="ts" setup>
import { ref } from 'vue';

import { useVbenModal } from '@vben/common-ui';

const formData = ref();
const title = ref();

interface Props {
  handleSubmit: (values: any) => void;
}
const props = defineProps<Props>();

const [Modal, modalApi] = useVbenModal({
  onCancel() {
    modalApi.close();
  },
  onConfirm() {
    props.handleSubmit(formData.value);
  },
  onOpenChange(isOpen: boolean) {
    if (isOpen) {
      formData.value = modalApi.getData<{
        data: { record: TypeRecord };
      }>().data.record;
      title.value = modalApi.getData<{ data: { isEdit: boolean } }>().data
        .isEdit
        ? '编辑子账号'
        : '新增子账号';
    }
  },
});
</script>
<template>
  <Modal :title="title">
    
  </Modal>
</template>
